using WeatherSystem.API.Models;

namespace WeatherSystem.API.Repositories
{
    /// <summary>
    /// 工作单元接口
    /// </summary>
    public interface IUnitOfWork : IDisposable
    {
        // 专用Repository接口（读写分离）
        IWeatherDataReadRepository WeatherDataRead { get; }
        IWeatherDataWriteRepository WeatherDataWrite { get; }
        IReadRepository<User> UserRead { get; }
        IWriteRepository<User> UserWrite { get; }
        IReadRepository<City> CityRead { get; }
        IWriteRepository<City> CityWrite { get; }
        IReadRepository<StatisticsEntry> StatisticsRead { get; }
        IWriteRepository<StatisticsEntry> StatisticsWrite { get; }

        // 兼容性属性（逐步迁移使用）
        IWeatherDataRepository WeatherData { get; }
        IUserRepository Users { get; }
        ICityRepository Cities { get; }
        IStatisticsRepository Statistics { get; }
        
        // 泛型Repository访问
        IRepository<T> Repository<T>() where T : class;
        
        // 事务管理
        Task<int> SaveChangesAsync();
        Task BeginTransactionAsync();
        Task CommitTransactionAsync();
        Task RollbackTransactionAsync();
    }
}